#include <bits/stdc++.h>
using namespace std;
int n,ans,a[100005],t[100005];
int main()
{
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
        t[a[i]]++;
    }
    sort(a+1,a+n+1);
    for(int i=t[a[1]]+1;i<=n;i)
    {
        int small_sum=i-1;
        ans+=min(small_sum-ans,t[a[i]]);
        i=i+t[a[i]];
    }
    cout << n-ans << endl;


    return 0;
}
